package com.term.domain;

import com.term.domain.enums.BooleanEnums;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by chenGang on 2017/1/4.
 */
@MappedSuperclass
public abstract class BaseDomain implements Serializable, Cloneable {
    private static final long serialVersionUID = 2820473684086191843L;

    /**
     * 该条记录创建时间
     */
    @Column(name = "created_time", updatable = false)
    protected Date createdTime = new Date();

    /**
     * 该条记录修改时间
     */
    @Column(name = "modify_time")
    protected Date modifyTime = new Date();

    /**
     * 是否删除(一般都是物理删除)
     */
    @Column(name = "is_deleted")
    @Enumerated(EnumType.STRING)
    protected BooleanEnums isDeleted = BooleanEnums.F;

    public BaseDomain() {
    }


    public BaseDomain(Date modifyTime, BooleanEnums isDeleted) {
        this.modifyTime = modifyTime;
        this.isDeleted = isDeleted;
    }

    public abstract Long getId();

    public abstract void setId(Long id);

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public BooleanEnums getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(BooleanEnums isDeleted) {
        this.isDeleted = isDeleted;
    }
}
